package com.kfm.am;

import java.util.List;
import java.util.Vector;

public class VectorTest {

    public static void main(String[] args) {
        // Vector 的方法 2, 1
        Vector vector = new Vector();
        vector.add(1);
        vector.add(0, 2);
        vector.addElement(3);
        Vector vector1 = new Vector();
        vector1.add(2);
        vector1.add(0, 3);
        vector.addAll(vector1);
        int obj = (int) vector.get(0);
        int num2 = (int) vector.get(1);
//        System.out.println(obj);
//        System.out.println(num2);
        for (Object v : vector) {
            System.out.println(v);
        }
        System.out.println("=======");
//        System.out.println("元素数量" + vector.size());
////        System.out.println(vector.elementAt(5));
//        System.out.println(vector.indexOf(2));
//        System.out.println(vector.lastElement());
//        System.out.println(vector.lastIndexOf(2));
//        System.out.println(vector.remove(1));
//        System.out.println(vector.indexOf(1));
//        System.out.println(vector.remove(new Integer(5)));
//        System.out.println(vector.removeAll(vector1));
//        System.out.println(vector.retainAll(vector1));
//        System.out.println(vector.set(3, 5)); // 返回之前下标为3的位置存储的元素
//        for (Object v : vector) {
//            System.out.println(v);
//        }
//
//        List l = vector.subList(0, 2); // [0, 2)
//        for (Object o : l) {
//            System.out.println(o);
//        }
//        System.out.println("=======");
//        Object[] objs = vector.toArray();
//        for (Object o : objs) {
//            System.out.println(o);
//        }
//        System.out.println(vector.capacity());
//        vector.trimToSize();
//        System.out.println(vector.capacity());
//        System.out.println(vector.size());

        Object[] objects = new Object[vector.size()];
        vector.copyInto(objects);
        for (Object object : objects) {
            System.out.println(object);
        }

//        vector.removeRa
    }
}
